package com.example.manager.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.example.manager.interceptor.AdminInterceptor;
import com.example.manager.interceptor.StudentInterceptor;
import com.example.manager.interceptor.TeacherInterceptor;

@Configuration
public class MyConfig {
	@Bean
	public WebMvcConfigurer webMvcConfigurer() {
		return new WebMvcConfigurer() {

			@Override
			public void addInterceptors(InterceptorRegistry registry) {
				registry.addInterceptor(new StudentInterceptor()).addPathPatterns("/Student/*");
				registry.addInterceptor(new TeacherInterceptor()).addPathPatterns("/Teacher/*");
				registry.addInterceptor(new AdminInterceptor()).addPathPatterns("/Admin/*");
			}
			
			
		};
	}
}
